Skip to content

fix: validate region parameter before URL interpolation to prevent SSRF#5819

Open
lucasjia-aws wants to merge 2 commits intoaws:masterfrom
lucasjia-aws:fix/validate-region-ssrf-prevention
Open

fix: validate region parameter before URL interpolation to prevent SSRF#5819
lucasjia-aws wants to merge 2 commits intoaws:masterfrom
lucasjia-aws:fix/validate-region-ssrf-prevention

Conversation

@lucasjia-aws
Copy link
Copy Markdown
Collaborator

@lucasjia-aws lucasjia-aws commented May 1, 2026

Issue:

SDK constructs endpoint URLs by interpolating the region parameter directly into URL strings without validation. A malicious region value can cause requests to be redirected to non-AWS hosts.

Fix:

Added a centralized region_validation module with strict regex validation for region format, and applied validate_region() at all affected endpoint URL construction sites across sagemaker-core, sagemaker-serve, and sagemaker-train.

Added test_region_validation.py with parametrized tests covering all known AWS regions and invalid/malicious inputs

@lucasjia-aws lucasjia-aws force-pushed the fix/validate-region-ssrf-prevention branch from 2544331 to 524545d Compare May 4, 2026 19:22
- Replace invalid test region "testregion" with valid AWS region "us-west-2" in profiler_app tests and tensorboard tests
- Add comprehensive region_validation test suite covering all known AWS regions
- Add tests for SSRF payload rejection and malformed region string handling
- Add tests for endpoint URL validation against AWS domains
- Ensure region validation regex accepts all legitimate AWS regions and rejects malicious inputs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant